package com.wcr.edu.info.manager.service;

import com.wcr.edu.info.manager.dao.StudentDao;
import com.wcr.edu.info.manager.domain.Student;

public class StudentService {
    StudentDao studentDao = new StudentDao();


    //添加方法(业务员)
    public boolean addS(Student student) {
        //收到客服上传的录入数据,传递给库管,让他上传
        boolean add = studentDao.addDao(student);
        return add;
    }

    //查看方法(业务员)
    public Student[] ckStudent() {
        boolean b = false;
        Student[] students = studentDao.ckStudent();
        for (int i = 0; i < students.length; i++) {
            Student student = students[i];
            if (student != null) {
                b = true;
                break;
            }
        }
        if (b) {
            return students;
        } else {
            return null;
        }
    }


    //判断学生学号是否存在
    public boolean isId(String id) {
        boolean is = false;
        Student[] students = studentDao.ckStudent();
        for (int i = 0; i < students.length; i++) {
            Student student = students[i];
            if (student != null && student.getId().equals(id)) {
                is = true;
                break;
            }
        }
        return is;
    }

    //修改学生方法(业务员)
    public boolean xiugai(String newid, Student newstudent) {
        return studentDao.xiugai(newid, newstudent);

    }

    //删除学生方法(业务员)
    public void shanChuId(String shanChuId) {
        studentDao.shanChuId(shanChuId);

    }
}

